namespace FormsAnywhere.UIProcessDesigner
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Collections.Specialized;
    using Microsoft.VisualStudio.Modeling.Validation;

    [ValidationState(ValidationState.Enabled)]
    public partial class SelectEntry
    {
        // Validation methods for SelectEntry go here.

        // This attribute identifies the method ValidateOptionsValue 
        // to the validation framework.
        [ValidationMethod
         ( // These values select which events cause the method to be invoked.
            ValidationCategories.Open |
             ValidationCategories.Save |
              ValidationCategories.Menu
         )
        ]
        // This method is applied to each instance of the 
        // type in a model. 
        private void ValidateOptionsValue(ValidationContext context)
        {
            if ((this.Options.Length > 0) && (!this.Options.Contains(":")))
            {
                context.LogError(
                    // Description
                             "Option entries are required to be separated by a colon (:)",
                    // Unique code for this error
                             "FAW001SelectEntryError",
                    // Objects to select when user double-clicks error
                             this);
            }
        }

        // This attribute identifies the method ValidateSelectionValue 
        // to the validation framework.
        [ValidationMethod
         ( // These values select which events cause the method to be invoked.
             ValidationCategories.Open |
             ValidationCategories.Save |
              ValidationCategories.Menu
         )
        ]
        // This method is applied to each instance of the 
        // type in a model. 
        private void ValidateSelectionValue(ValidationContext context)
        {
            if ((this.Selections.Length > 0) && (!this.Selections.Contains(":")))
            {
                context.LogError(
                    // Description
                             "Selection entries are required to be separated by a colon (:)",
                    // Unique code for this error
                             "FAW002SelectEntryError",
                    // Objects to select when user double-clicks error
                             this);
            }
        }
    }
}
